package com.study.app.service;

import com.study.app.domain.AppUser;
import com.study.app.domain.bo.AppUserBo;
import com.study.app.domain.bo.AppUserStudentBo;
import com.study.common.core.domain.PageQuery;
import com.study.common.core.domain.R;
import com.study.common.core.domain.model.*;
import com.study.common.core.page.TableDataInfo;
import com.study.app.domain.vo.AppUserVo;

import java.util.Collection;
import java.util.List;

/**
 * App用户Service接口
 *
 * @author study
 * @date 2023-04-19
 */
public interface IAppUserService {

    /**
     *  修改手机号
     */
    void exchangePhone(Long userId, AppSmsCodeBody appSmsCodeBody);

    /**
     * 绑定手机号
     */
    void bindPhone(Long userId, AppSmsCodeBody appSmsCodeBody);

    /**
     * 查询App用户
     */
    AppUserVo queryById(Long id);
    /**
     * 查询App用户详细信息
     */
    AppUser queryUserDetail(AppUser user);

    /**
     * 查询App用户
     */
    AppUserVo selectQueryById(Long id);

    /**
     * 查询App用户列表
     */
    TableDataInfo<AppUserVo> queryPageList(AppUserBo bo, PageQuery pageQuery);

    /**
     * 查询App用户列表
     */
    List<AppUserVo> queryList(AppUserBo bo);

    /**
     * 新增App用户
     */
    Boolean insertByBo(AppUserBo bo);

    /**
     * 修改App用户
     */
    Boolean updateByBo(AppUserBo bo);

    /**
     * 校验并批量删除App用户信息
     */
    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);

    /**
     * 修改密码
     */
    void replacePassword(Long userId, AppReplacePasswordBody replacePasswordBody);

    /**
     * 设置密码
     */
    void setPassword(Long userId, String password);

    /**
     * 注销-不可逆
     */
    void logOff(AppLoginUser loginUser, AppSmsCodeBody appSmsCodeBody);

    /**
     * 根据注册码查询用户
     * @param bo
     * @return
     */
    AppUserVo getUserByCode(AppUserBo bo);


    /**
     * 根据用户编码，获取用户消息推送deviceToken
     * @param userCode
     * @return
     */
    String getUserInfo(String userCode);

    /**
     * 后台服务单向用户重置密码
     * @param userId
     * @return
     */
    Boolean restPassWord(Long userId);

    /**
     * 设置用户消息推送 deviceToken key
     *
     * @param userCode
     * @param deviceToken
     * @return
     */
    Boolean setUserDeviceToken(String userCode, String deviceToken);


    void logOffEmail(AppLoginUser appLoginUser, AppEmailCodeBody appEmailCodeBody);

    void smsExchangePassword(AppForgetPasswordBody appForgetPasswordBody);

    void emailExchangePassword(Long userId, AppForgetPasswordBody appForgetPasswordBody);

    void exchangeMail(Long userId, AppEmailCodeBody appEmailCodeBody);

    /**
     * 修改APP用户状态
     * @param user
     * @return
     */
    int updateAppUserStatus(AppUser user);
    /**
     * 获取用户未读消息
     */
    R<?> getNoReadMessage();


    Boolean createStudyAccount(AppUserStudentBo bo, Long parentId);

    List<AppUser> quertStudentList(Long userId) throws Exception;

    Boolean updateStudent(Long studentId,int status);

    Boolean updateStentInfo(AppUserStudentBo bo);
}
